package com.sikao.app.ui;

import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ExpandableListView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.cnzhizi.wheelpop.model.OneModel;
import com.cnzhizi.wheelpop.ui.SkmDatePickerPopup;
import com.cnzhizi.wheelpop.ui.SkmModiPopup;
import com.sikao.app.R;
import com.sikao.app.adapter.MlvMallOrderExtrasItemAdapter;
import com.sikao.app.adapter.MlvMallOrderExtrasItemForTypeFourAdapter;
import com.sikao.app.bean.MallCreateOrderBean;
import com.sikao.app.bean.MallCreateOrderSubmitBean;
import com.sikao.app.bean.MallGoodsAttrChangePriceBean;
import com.sikao.app.bean.MallGoodsAttrChangePriceSubmitBean;
import com.sikao.app.bean.MallGoodsDetailBean;
import com.sikao.app.dao.MallCreatOrderModel;
import com.sikao.app.dao.MallGoodsAttrChangePriceModel;
import com.sikao.app.net.OnNetBackListener;
import com.sikao.app.ui.base.BaseActivity;
import com.sikao.app.utils.JSONUtil;
import com.sikao.app.utils.TimeUtil;
import com.sikao.app.utils.Utils;
import com.sikao.app.view.MyListView;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;


/**
 * 商城商品下单
 */
public class MallOrderActivity extends BaseActivity implements View.OnClickListener {

    private TextView titleTv;
    private ImageView backIv;
    private Button orderBtn;
    private MyListView myListView;
    private ExpandableListView myListViewFortypeFour;
    private MallGoodsDetailBean mallGoodsDetailBean;
    private MlvMallOrderExtrasItemAdapter mlvMallOrderExtrasItemAdapter;

    private MlvMallOrderExtrasItemForTypeFourAdapter mlvMallOrderExtrasItemForTypeFourAdapter;

    private List<MallGoodsDetailBean.ResBean.GoodsAttrsBean> getGoods_attrs;//这是有商品详情页面传过来的全部的商品信息

    private List<MallGoodsDetailBean.ResBean.GoodsAttrsBean> getGoods_attrsForTypeFour = new ArrayList<MallGoodsDetailBean.ResBean.GoodsAttrsBean>();//这是有商品详情页面传过来的全部的商品信息

    private TextView tv;
    private TextView tvUnit;
    private TextView tv_mall_order_price;
    private TextView tv_mall_order_total_price;
    private EditText et_mall_order_number;

    private MallGoodsAttrChangePriceModel mallGoodsAttrChangePriceModel;
    private MallGoodsAttrChangePriceSubmitBean mallGoodsAttrChangePriceSubmitBean = new MallGoodsAttrChangePriceSubmitBean();
    private List<MallGoodsAttrChangePriceSubmitBean.AttrBean> attrForChangePrice = new ArrayList<MallGoodsAttrChangePriceSubmitBean.AttrBean>();//修改的价格提交的商品的产品指标
    private List<MallGoodsAttrChangePriceSubmitBean.AttrBean> attrForChangePriceForTypeFour = new ArrayList<MallGoodsAttrChangePriceSubmitBean.AttrBean>();//修改的价格提交的商品的产品指标 仅放多选


    private MallCreatOrderModel mallCreatOrderModel;
    private MallCreateOrderSubmitBean mallCreateOrderSubmitBean = new MallCreateOrderSubmitBean();
    private List<MallCreateOrderSubmitBean.AttrBean> attrCreatList = new ArrayList<MallCreateOrderSubmitBean.AttrBean>();//发布提交的商品的产品指标

    //提货时间
    private LinearLayout ll_mall_order_date;
    private TextView tv_mall_order_date;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.activity_mall_order);
        super.onCreate(savedInstanceState);

    }

    @Override
    protected void initData() {
        mallGoodsDetailBean = (MallGoodsDetailBean) getIntent().getSerializableExtra("mallGoodsDetailBean");

        getGoods_attrs = mallGoodsDetailBean.getRes().getGoods_attrs();


    }

    @Override
    protected void initView() {
        titleTv = (TextView) findViewById(R.id.title_middle_tv);
        backIv = (ImageView) findViewById(R.id.title_left_img);
        orderBtn = (Button) findViewById(R.id.order_btn);
        myListView = (MyListView) findViewById(R.id.mlv_mall_order_extras);
        myListViewFortypeFour = (ExpandableListView) findViewById(R.id.mlv_mall_order_extras_typefour);
        tv = (TextView) findViewById(R.id.tv);
        tvUnit = (TextView) findViewById(R.id.tv_mall_order_number_unit);

        tv_mall_order_price = (TextView) findViewById(R.id.tv_mall_order_price);
        tv_mall_order_total_price = (TextView) findViewById(R.id.tv_mall_order_total_price);
        et_mall_order_number = (EditText) findViewById(R.id.et_mall_order_number);

        ll_mall_order_date = (LinearLayout) findViewById(R.id.ll_mall_order_date);
        tv_mall_order_date = (TextView) findViewById(R.id.tv_mall_order_date);

    }

    @Override
    protected void initListener() {
        backIv.setOnClickListener(this);
        orderBtn.setOnClickListener(this);
        ll_mall_order_date.setOnClickListener(this);
        et_mall_order_number.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void afterTextChanged(Editable s) {
                TimerTask task = new TimerTask() {
                    public void run() {
                        //execute the task
                        attrChangePrice();
                    }
                };
                Timer timer = new Timer();
                timer.schedule(task, 1500);
            }
        });
    }


    @Override
    protected void init() {
        titleTv.setText("立即下单");
        backIv.setVisibility(View.VISIBLE);
        tv.setText("总库存" + mallGoodsDetailBean.getRes().getOrigin_number() + mallGoodsDetailBean.getRes().getUnit() + ",剩余库存" + mallGoodsDetailBean.getRes().getNumber() + mallGoodsDetailBean.getRes().getUnit());
        tvUnit.setText("采购数量(" + mallGoodsDetailBean.getRes().getUnit() + ")：");
        et_mall_order_number.setHint("至少采购" + mallGoodsDetailBean.getRes().getLeast_number() + mallGoodsDetailBean.getRes().getUnit());
        Utils.showLog("==============getGoods_attrs" + getGoods_attrs.size());
        //这里只显示 3单选 5下拉 统一处理成 下拉
        if (getGoods_attrs != null && getGoods_attrs.size() > 0) {

            for (int i = 0; i < getGoods_attrs.size(); i++) {
                if (!("3".equals(getGoods_attrs.get(i).getAttr_type())) && !("5".equals(getGoods_attrs.get(i).getAttr_type()))) {
                    //将多选单独放置
                    if ("4".equals(getGoods_attrs.get(i).getAttr_type())) {
                        getGoods_attrsForTypeFour.add(getGoods_attrs.get(i));
                    }
                    getGoods_attrs.remove(i);
                    i--;
                }

            }
            if (getGoods_attrs.size() > 0) {
                //为content赋值 默认是显示第一个
                for (int i = 0; i < getGoods_attrs.size(); i++) {
                    //给提交的参数设置默认值
                    MallGoodsAttrChangePriceSubmitBean.AttrBean attrBean = new MallGoodsAttrChangePriceSubmitBean.AttrBean();

                    if (getGoods_attrs.get(i).getDefault_value().size() > 0) {
                        for (int j = 0; j < getGoods_attrs.get(i).getIs_default().size(); j++) {
                            if ("true".equals(getGoods_attrs.get(i).getIs_default().get(j))) {
                                getGoods_attrs.get(i).setContent(getGoods_attrs.get(i).getDefault_value().get(j) + "    浮动值：" + getGoods_attrs.get(i).getChange_price().get(j));
                                attrBean.setId(getGoods_attrs.get(i).getId());
                                attrBean.setValue(getGoods_attrs.get(i).getDefault_value().get(j));
                                attrForChangePrice.add(attrBean);
                                // break;//下拉和单选只有一个默认值
                            }
                        }
                    }
                }
            }

            //将多选加入到要提交的数据中
            if (getGoods_attrsForTypeFour.size() > 0) {
                for (int i = 0; i < getGoods_attrsForTypeFour.size(); i++) {


                    if (getGoods_attrsForTypeFour.get(i).getDefault_value().size() > 0) {

                        for (int j = 0; j < getGoods_attrsForTypeFour.get(i).getIs_default().size(); j++) {
                            //给提交的参数设置默认值
                            MallGoodsAttrChangePriceSubmitBean.AttrBean attrBean = new MallGoodsAttrChangePriceSubmitBean.AttrBean();
                            if ("true".equals(getGoods_attrsForTypeFour.get(i).getIs_default().get(j))) {
                                attrBean.setId(getGoods_attrsForTypeFour.get(i).getId());
                                attrBean.setValue(getGoods_attrsForTypeFour.get(i).getDefault_value().get(j));
                                attrForChangePriceForTypeFour.add(attrBean);
                                // break;//下拉和单选只有一个默认值

                                Utils.showLog("初始化多选 将默认值赋值：" + "i=" + i + " j=" + j + " " + getGoods_attrsForTypeFour.get(i).getDefault_value().get(j));
                            }
                        }
                    }


                }
            }

            for (MallGoodsAttrChangePriceSubmitBean.AttrBean ab : attrForChangePriceForTypeFour) {
                Utils.showLog("初始化多选打印====id " + ab.getId() + " Value " + ab.getValue());
            }

            mlvMallOrderExtrasItemAdapter = new MlvMallOrderExtrasItemAdapter(this, mlvMallOrderExtrasItemAdapterOnClickListener, getGoods_attrs);
            myListView.setAdapter(mlvMallOrderExtrasItemAdapter);

            mlvMallOrderExtrasItemForTypeFourAdapter = new MlvMallOrderExtrasItemForTypeFourAdapter(this, getGoods_attrsForTypeFour, mlvMallOrderExtrasItemForTypeFourAdapterOnClickListener);
            myListViewFortypeFour.setAdapter(mlvMallOrderExtrasItemForTypeFourAdapter);
            myListViewFortypeFour.setGroupIndicator(null);
            for (int i = 0; i < mlvMallOrderExtrasItemForTypeFourAdapter.getGroupCount(); i++) {

                myListViewFortypeFour.expandGroup(i);
            }
            myListViewFortypeFour.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {

                @Override
                public boolean onGroupClick(ExpandableListView parent, View v,
                                            int groupPosition, long id) {
                    // TODO Auto-generated method stub
                    return true;
                }
            });

        }
        tv_mall_order_price.setText(mallGoodsDetailBean.getRes().getPrice() + "元");

    }


    int positionItem = 0;//选择的第几条附加值


    final List<OneModel> oneModelList = new ArrayList<OneModel>();//滚轮一级
    public SkmModiPopup skmModiPopup;

    private void showPop() {
        skmModiPopup = new SkmModiPopup(this, skmPopOnClickListener, oneModelList, "选择", 1, null);
        skmModiPopup.showAtLocation(findViewById(R.id.ll_mall_order),
                Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
    }


    public SkmModiPopup.SkmPopOnClickListener skmPopOnClickListener = new SkmModiPopup.SkmPopOnClickListener() {

        @Override
        public void myOnClick(int pOneCurrent, int pTwoCurrent, int pThreeCurrent, View v, View root) {
            skmModiPopup.dismiss();
            Utils.showLog("========SkmPopOnClickListener positionItem=" + positionItem + " pOneCurrent=" + pOneCurrent + " oneModelListForGoodsClassify.size" + oneModelList.size());

            //Toast.makeText(MallOrderActivity.this, getGoods_attrs.get(positionItem).getDefault_value().get(pOneCurrent) + "  " + getGoods_attrs.get(positionItem).getId(), Toast.LENGTH_SHORT).show();
            //更新提交参数中修改的这个参数


            MallGoodsAttrChangePriceSubmitBean.AttrBean attrBean = new MallGoodsAttrChangePriceSubmitBean.AttrBean();
            attrBean.setId(getGoods_attrs.get(positionItem).getId());
            attrBean.setValue(getGoods_attrs.get(positionItem).getDefault_value().get(pOneCurrent));
            // attrForChangePrice 和 getGoods_attrs 长度一致
            attrForChangePrice.set(positionItem, attrBean);//替换参数值


            //更改content值 这个字段 如果重新生成bean要重新写上去
            getGoods_attrs.get(positionItem).setContent(getGoods_attrs.get(positionItem).getDefault_value().get(pOneCurrent) + "    浮动值：" + getGoods_attrs.get(positionItem).getChange_price().get(pOneCurrent));

            mlvMallOrderExtrasItemAdapter.notifyDataSetChanged();
            //计算价格
            attrChangePrice();
        }
    };
    //adapter的回调
    MlvMallOrderExtrasItemAdapter.MlvMallOrderExtrasItemAdapterOnClickListener mlvMallOrderExtrasItemAdapterOnClickListener = new MlvMallOrderExtrasItemAdapter.MlvMallOrderExtrasItemAdapterOnClickListener() {
        @Override
        public void myOnClick(int position) {
            //Toast.makeText(MallOrderActivity.this, " 点击:" + position, Toast.LENGTH_SHORT).show();
            positionItem = position;
            Utils.showLog("========MlvMallOrderExtrasItemAdapterOnClickListener positionItem=" + positionItem);
            oneModelList.clear();
            for (int i = 0; i < getGoods_attrs.get(positionItem).getDefault_value().size(); i++) {

                OneModel oneModel = new OneModel();
                oneModel.setId(getGoods_attrs.get(positionItem).getId());//属性的id
                oneModel.setName(getGoods_attrs.get(positionItem).getDefault_value().get(i) + "    浮动值：" + getGoods_attrs.get(positionItem).getChange_price().get(i));//属性的值
                oneModelList.add(oneModel);
            }
            showPop();

        }
    };

    //多选的点击回调
/*

    MlvMallOrderExtrasItemForTypeFourAdapter.MlvMallOrderExtrasItemForTypeFourAdapterOnClickListener mlvMallOrderExtrasItemForTypeFourAdapterOnClickListener=new MlvMallOrderExtrasItemForTypeFourAdapter.MlvMallOrderExtrasItemForTypeFourAdapterOnClickListener(){

        @Override
        public void myOnClick(int position) {

        }
    };
*/


    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.title_left_img:
                finish();
                break;
            case R.id.order_btn:
                //调用下单方法
                createOrder();
                break;
            case R.id.ll_mall_order_date:
                //调用提货时间选择
                showTimePop("选择提货时间", ll_mall_order_date);
                break;
            default:
                break;
        }
    }

    /**
     * 从后台获取计算的价格
     */
    private void attrChangePrice() {
        mallGoodsAttrChangePriceModel = new MallGoodsAttrChangePriceModel(this, new OnNetBackListener<MallGoodsAttrChangePriceBean>() {
            @Override
            public void netBack(MallGoodsAttrChangePriceBean data) {
                if (data == null) {
                    Toast.makeText(MallOrderActivity.this, data.getMsg(), Toast.LENGTH_SHORT).show();
                } else {
                    if (data.getStatus() == 1) {
                        //给单价和总价重新赋值
                        tv_mall_order_price.setText(data.getRes().getUnitPrice());
                        tv_mall_order_total_price.setText(data.getRes().getTotalPrice());
                    } else {
                        Toast.makeText(MallOrderActivity.this, data.getMsg(), Toast.LENGTH_SHORT).show();
                    }
                }
            }
        }
        );
        mallGoodsAttrChangePriceSubmitBean.setType("Coal");
        mallGoodsAttrChangePriceSubmitBean.setGoodsId(mallGoodsDetailBean.getRes().getId());
        mallGoodsAttrChangePriceSubmitBean.setBuyNumber(et_mall_order_number.getText().toString());
        mallGoodsAttrChangePriceSubmitBean.setObjType("goods");

     /*   String value = "";
        for (int i = 0; i < attrForChangePrice.size(); i++) {

			MallGoodsAttrChangePriceSubmitBean.AttrBean attrBean = new MallGoodsAttrChangePriceSubmitBean.AttrBean();
			attrBean.setId(attrForChangePrice.get(i).getId());
			// 取消|
			value = attrForChangePrice.get(i).getValue();
			Utils.showLog("====value前:"+value);
			value = value.substring(0,value.lastIndexOf("    "));
			Utils.showLog("====value后:"+value);
			attrBean.setValue(value);

			attrForChangePrice.set(i,attrBean);

		}*/

        for (MallGoodsAttrChangePriceSubmitBean.AttrBean ab : attrForChangePriceForTypeFour) {
            Utils.showLog("====最后id " + ab.getId() + " Value " + ab.getValue());
        }

        List<MallGoodsAttrChangePriceSubmitBean.AttrBean> attrForChangePriceAll = new ArrayList<MallGoodsAttrChangePriceSubmitBean.AttrBean>();//修改的价格提交的商品的产品指标


        for (MallGoodsAttrChangePriceSubmitBean.AttrBean afcp : attrForChangePrice) {
            attrForChangePriceAll.add(afcp);
        }
        for (MallGoodsAttrChangePriceSubmitBean.AttrBean afcp : attrForChangePriceForTypeFour) {
            attrForChangePriceAll.add(afcp);
        }

        mallGoodsAttrChangePriceSubmitBean.setAttr(attrForChangePriceAll);
        mallGoodsAttrChangePriceModel.request(JSONUtil.toJSON(mallGoodsAttrChangePriceSubmitBean), false);

    }

    /**
     * 下单
     */
    private void createOrder() {
        if (TextUtils.isEmpty(et_mall_order_number.getText())) {
            Toast.makeText(MallOrderActivity.this, "数量不能为空", Toast.LENGTH_SHORT).show();
        }
        mallCreatOrderModel = new MallCreatOrderModel(this, new OnNetBackListener<MallCreateOrderBean>() {
            @Override
            public void netBack(MallCreateOrderBean data) {
                if (data == null) {
                    Toast.makeText(MallOrderActivity.this, data.getMsg(), Toast.LENGTH_SHORT).show();
                } else {
                    if (data.getStatus() == 1) {
                        Toast.makeText(MallOrderActivity.this, data.getMsg(), Toast.LENGTH_SHORT).show();
                        //跳转到某个界面
                        MallDetailsActivity.mallDetailsActivity.finish();
                        finish();
                    } else {
                        Toast.makeText(MallOrderActivity.this, data.getMsg(), Toast.LENGTH_SHORT).show();
                    }
                }
            }
        });
        //{"type":"mall","goodsId":"17","price":"370.00","totalPrice":"3700.00","number":"10",
        // "attrForChangePrice":[{"id":"2","value":"7%"},{"id":"3","value":"7000大卡"}]}
        mallCreateOrderSubmitBean.setType("mall");
        mallCreateOrderSubmitBean.setGoodsId(mallGoodsDetailBean.getRes().getId());
        mallCreateOrderSubmitBean.setPrice(tv_mall_order_price.getText().toString());
        mallCreateOrderSubmitBean.setTotalPrice(tv_mall_order_total_price.getText().toString());
        mallCreateOrderSubmitBean.setNumber(et_mall_order_number.getText().toString());

      /*  attrCreatList.clear();

        String value = "";
        for (int i = 0; i < attrForChangePrice.size(); i++) {
            MallCreateOrderSubmitBean.AttrBean attrBean = new MallCreateOrderSubmitBean.AttrBean();
            attrBean.setId(attrForChangePrice.get(i).getId());
            attrBean.setValue(attrForChangePrice.get(i).getValue());
            attrCreatList.add(attrBean);
        }
        mallCreateOrderSubmitBean.setAttr(attrCreatList);*/


        attrCreatList.clear();
        List<MallGoodsAttrChangePriceSubmitBean.AttrBean> attrForChangePriceAll = new ArrayList<MallGoodsAttrChangePriceSubmitBean.AttrBean>();//修改的价格提交的商品的产品指标


        for (MallGoodsAttrChangePriceSubmitBean.AttrBean afcp : attrForChangePrice) {
            attrForChangePriceAll.add(afcp);
        }
        for (MallGoodsAttrChangePriceSubmitBean.AttrBean afcp : attrForChangePriceForTypeFour) {
            attrForChangePriceAll.add(afcp);
        }

        for (int i = 0; i < attrForChangePriceAll.size(); i++) {
            MallCreateOrderSubmitBean.AttrBean attrBean = new MallCreateOrderSubmitBean.AttrBean();
            attrBean.setId(attrForChangePriceAll.get(i).getId());
            attrBean.setValue(attrForChangePriceAll.get(i).getValue());
            attrCreatList.add(attrBean);
        }
        mallCreateOrderSubmitBean.setAttr(attrCreatList);

        mallCreatOrderModel.request(JSONUtil.toJSON(mallCreateOrderSubmitBean), true);
    }

    //多选的点击

    MlvMallOrderExtrasItemForTypeFourAdapter.MlvMallOrderExtrasItemForTypeFourAdapterOnClickListener mlvMallOrderExtrasItemForTypeFourAdapterOnClickListener = new MlvMallOrderExtrasItemForTypeFourAdapter.MlvMallOrderExtrasItemForTypeFourAdapterOnClickListener() {


        @Override
        public void myOnClick(View v) {
            int parentPos = (Integer) v.getTag(R.id.parentPos);
            int childPos = (Integer) v.getTag(R.id.childPos);
            boolean isChecked = (boolean) v.getTag(R.id.ischecked);
            //更新提交参数中修改的这个参数
            MallGoodsAttrChangePriceSubmitBean.AttrBean attrBean = new MallGoodsAttrChangePriceSubmitBean.AttrBean();

            if (isChecked) {
                Utils.showLog("===被选中" + getGoods_attrsForTypeFour.get(parentPos).getDefault_value().get(childPos));

                attrBean.setId(getGoods_attrsForTypeFour.get(parentPos).getId());
                attrBean.setValue(getGoods_attrsForTypeFour.get(parentPos).getDefault_value().get(childPos));
                attrForChangePriceForTypeFour.add(attrBean);


            } else {
                Utils.showLog("===取消选中" + getGoods_attrsForTypeFour.get(parentPos).getDefault_value().get(childPos));


                for (int i = 0; i < attrForChangePriceForTypeFour.size(); i++) {
                    if (getGoods_attrsForTypeFour.get(parentPos).getDefault_value().get(childPos).equals(attrForChangePriceForTypeFour.get(i).getValue())) {
                        attrForChangePriceForTypeFour.remove(attrForChangePriceForTypeFour.get(i));

                        break;
                    }
                }



              /*  attrForChangePriceForTypeFour.remove(attrBean);*/
            }

            // Utils.showLog("====id "+getGoods_attrsForTypeFour.get(parentPos).getId()+" Value "+getGoods_attrsForTypeFour.get(parentPos).getDefault_value().get(childPos));
            // Utils.showLog("====println");

            //计算价格
            attrChangePrice();

        }
    };


    public SkmDatePickerPopup skmDatePickerPopup;

    private void showTimePop(String content, View view) {

        //skmDatePickerPopup = new SkmDatePickerPopup(this, skmDatePickerPopupOnClickListener, content, view);
        //添加两个参数 是否需要更改默认当前时间 isShouledChangeDate 更改后的时间 targetDate
        boolean isShouledChangeDate = false;
        long targetDate = 0l;
        long startTime = 0l;
        Date date = new Date(startTime);//取时间
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        targetDate = calendar.getTimeInMillis();

        //如果点击的是开始菜单 则时间默认

        isShouledChangeDate = false;


        skmDatePickerPopup = new SkmDatePickerPopup(this, skmDatePickerPopupOnClickListener, content, view, isShouledChangeDate, targetDate);



        skmDatePickerPopup.showAtLocation(findViewById(R.id.ll_mall_order),
                Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
    }

    public SkmDatePickerPopup.SkmDatePickerPopupOnClickListener skmDatePickerPopupOnClickListener = new SkmDatePickerPopup.SkmDatePickerPopupOnClickListener() {

        @Override
        public void myOnClick(int year, int month, int day, int hour, int minute, View v, View root) {
            skmDatePickerPopup.dismiss();
          /*  Toast.makeText(ReleaseGoodsActivity.this, "您选择的日期：" + year + "年  "
                    + month + "月  " + day + "日" + hour + "时 " + minute + "分钟", Toast.LENGTH_SHORT).show();*/
            String time = year + "-" + month + "-" + day + " " + hour + ":" + minute;
            Utils.showLog("============时间" + TimeUtil.timeToTimeStampForSecond(time, TimeUtil.fotmatString2));
            switch (root.getId()) {
                case R.id.ll_mall_order_date://开始时间
                    tv_mall_order_date.setText(time);
                    //保存提货时间的值
                    //addGoodsStepOneSubmitBean.setStartTime(TimeUtil.timeToTimeStampForSecond(time, TimeUtil.fotmatString2));
                    break;

            }
        }

    };


}

